#!/bin/bash
# https://github.com/ariya/phantomjs/blob/master/examples/render_multi_url.js


for file in html2img/*.html
do
  mydir=`dirname "$file"`    
  myfile=`basename "$file"`
  echo ""
  echo "- Processing : $mydir --- $myfile"
  #phantomjs --load-plugins=yes rasterize.js file://$(pwd)/$file $file.png

  phantomjs rasterize_new.js "file://$(pwd)/$file" "$mydir/img/$myfile.png"
  #~ convert "$file.png" -crop 1024x768+0+0 "$file.png" && convert "$file.png" -filter Lanczos -thumbnail 200x150 "$file-thumbnail.png"
  echo "- Done processing : $file"
done
